import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class MyService extends StatefulWidget {
  final Map<String,dynamic> menuData;
  MyService({this.menuData});
  @override
  _MyServiceState createState() => _MyServiceState();
}

class _MyServiceState extends State<MyService> {
  List<dynamic> menuData;

  @override
  void initState() {

    setState(() {
      menuData=widget.menuData['result'];
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 750.w,
//      height:500.w,
      color:Colors.grey[200],

      alignment: Alignment.center,
      child:Container(
        width:720.w,
        padding: EdgeInsets.symmetric(vertical: 30.w,horizontal: 20.w),
        decoration: BoxDecoration(
          color:Colors.white,
          borderRadius: BorderRadius.circular(8.w)
        ),
        child: Wrap(
            runSpacing:50.w,
            spacing: 70.w,
            alignment: WrapAlignment.start,
            runAlignment:WrapAlignment.end,
            children: menuData.map((value) {
              return Container(
                color:Colors.white,
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.center,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    GestureDetector(
                      onTap: () {
                        if(value['name']=='会员中心'){
                          Navigator.pushNamed(context, '/member_center');
                        }
                        if(value['name']=='我的收藏'){
                          Navigator.pushNamed(context, '/collect');
                        }

                      },
                      child: Column(
                        children: [
                          Container(
                            child: Image.network(
                              value['pic'],
                              width: 50.w,
                              height: 50.w,
                              fit: BoxFit.cover,
                            ),
                          ),
                          SizedBox(height: 20.w),
                          Text(value['name']),
                        ],
                      ),
                    ),
//                    VerticalDivider(),
                  ],
                ),
              );
            }).toList()),
      ),
    );

  }
}
